//
//  DMMessageBaseModel.h
//  HDMainWindow
//
//  Created by apple on 2017/5/5.
//  Copyright © 2017年 com.devin.definesys. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LLSDKError.h"

typedef NS_ENUM(NSInteger, LLMessageStatus) {
    kLLMessageStatusPending  = 0,
    kLLMessageStatusDelivering = 1,
    kLLMessageStatusSuccessed = 2,
    kLLMessageStatusFailed = 3,
    kLLMessageStatusWaiting = 10086,
    kLLMessageStatusNone
};

typedef NS_OPTIONS(NSInteger, LLMessageCellUpdateType) {
    kLLMessageCellUpdateTypeNone = 0,          //
    kLLMessageCellUpdateTypeThumbnailChanged = 1,      //缩略图改变
    kLLMessageCellUpdateTypeUploadStatusChanged = 1 << 1,   //上传状态改变
    kLLMessageCellUpdateTypeDownloadStatusChanged = 1 << 2, //下载状态改变
    kLLMessageCellUpdateTypeNewForReuse = 1 << 3,       //首次使用，或者重用
    
};

@interface DMMessageBaseModel : NSObject

//展示消息的CellHeight，计算一次，然后缓存
@property (nonatomic) CGFloat cellHeight;

@property (nonatomic, copy) NSString *messageId;
@property (nonatomic, copy) NSString *conversationId;

//消息发送方
@property (nonatomic, copy) NSString *from;
//消息接收方
@property (nonatomic, copy) NSString *to;
//是否是本人发出
@property (nonatomic, getter=isFromMe) BOOL fromMe;

@property (nonatomic) NSTimeInterval timestamp;

@property (nonatomic) NSString *text;

@property (nonatomic) NSDictionary *ext;

//消息即将被删除
@property (nonatomic) BOOL isDeleting;

@property (nonatomic) BOOL isSelected;

//消息类型
@property (nonatomic) NSString *modelType ;

@property (nonatomic) LLMessageCellUpdateType updateType ;

@property (nonatomic) LLSDKError *error;

#pragma mark - 消息状态 -
@property (nonatomic, readonly) LLMessageStatus messageStatus;

#pragma mark - MessageCell 更新
#pragma mark 因为APP有消息缓存(默认1300条)，所以减少重复计算是有必要的 -

- (void)setNeedsUpdateThumbnail;

- (void)setNeedsUpdateUploadStatus;

- (void)setNeedsUpdateDownloadStatus;

- (void)setNeedsUpdateForReuse;

- (BOOL)checkNeedsUpdateThumbnail;

- (BOOL)checkNeedsUpdateUploadStatus;

- (BOOL)checkNeedsUpdateDownloadStatus;

- (BOOL)checkNeedsUpdateForReuse;

- (BOOL)checkNeedsUpdate;

- (void)clearNeedsUpdateThumbnail;

- (void)clearNeedsUpdateUploadStatus;

- (void)clearNeedsUpdateDownloadStatus;

- (void)clearNeedsUpdateForReuse;


@end
